docs(flux2): clarify image= is reference conditioning, not img2img#13557
Open
NazarKozak wants to merge 2 commits intohuggingface:mainfrom
Open
docs(flux2): clarify image= is reference conditioning, not img2img#13557NazarKozak wants to merge 2 commits intohuggingface:mainfrom
NazarKozak wants to merge 2 commits intohuggingface:mainfrom
Conversation
stevhliu
approved these changes
Apr 27, 2026
Member
stevhliu
left a comment
There was a problem hiding this comment.
docs lgtm, handing off to @sayakpaul for final look :)
Comment on lines
+37
to
+40
| The `image` argument on `Flux2Pipeline` and `Flux2KleinPipeline` is **reference conditioning**, not | ||
| img2img. Reference images are encoded into additional attention tokens that flow through the | ||
| transformer alongside the text prompt — there is no noisy latent initialization, and so no `strength` | ||
| parameter to scale. |
Member
There was a problem hiding this comment.
Suggested change
| The `image` argument on `Flux2Pipeline` and `Flux2KleinPipeline` is **reference conditioning**, not | |
| img2img. Reference images are encoded into additional attention tokens that flow through the | |
| transformer alongside the text prompt — there is no noisy latent initialization, and so no `strength` | |
| parameter to scale. | |
| The `image` argument on [`Flux2Pipeline`[ and [`Flux2KleinPipeline`] is a *reference conditioning*. Reference images are encoded as additional attention tokens that flow through the | |
| transformer alongside the text prompt. Flux.2 doesn't add noise to the input image unlike [`FluxImg2ImgPipeline`]. Passing `strength` to [`Flux2Pipeline`] raises: |
Comment on lines
+42
to
+45
| This differs from `StableDiffusionImg2ImgPipeline`, `FluxImg2ImgPipeline`, and | ||
| `FluxKontextInpaintPipeline`, which add noise to a latent encoding of the input image and then | ||
| partially denoise it. If you port code from those pipelines and pass `strength=...` to a Flux.2 | ||
| pipeline, you will see: |
Member
There was a problem hiding this comment.
Suggested change
| This differs from `StableDiffusionImg2ImgPipeline`, `FluxImg2ImgPipeline`, and | |
| `FluxKontextInpaintPipeline`, which add noise to a latent encoding of the input image and then | |
| partially denoise it. If you port code from those pipelines and pass `strength=...` to a Flux.2 | |
| pipeline, you will see: |
Comment on lines
+51
to
+53
| Drop the `strength` kwarg and pass references via `image=` (a single image, or a list for multiple | ||
| references). For Flux.2 inpainting (which does add noise to a latent and therefore does take a | ||
| `strength` parameter), use `Flux2KleinInpaintPipeline` instead. |
Member
There was a problem hiding this comment.
Suggested change
| Drop the `strength` kwarg and pass references via `image=` (a single image, or a list for multiple | |
| references). For Flux.2 inpainting (which does add noise to a latent and therefore does take a | |
| `strength` parameter), use `Flux2KleinInpaintPipeline` instead. | |
| Drop the `strength` argument and pass references with `image`. For inpainting, use [`Flux2KleinInpaintPipeline`] instead. |
Apply @stevhliu's suggestions: - Compress 'Reference conditioning vs. img2img' section. - Use [`ClassName`] cross-reference syntax for Flux2Pipeline, Flux2KleinPipeline, FluxImg2ImgPipeline, Flux2KleinInpaintPipeline. - Drop the 'This differs from...' paragraph; the TypeError example alone makes the point.
Author
|
Thanks for the review @stevhliu! Applied all three suggestions in 2db8a9e — tightened the wording and switched to @sayakpaul — ready for your final look whenever you have a moment 🙏 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
The
image=parameter onFlux2PipelineandFlux2KleinPipelineis currently described as a "starting point", which mirrors the SD/Flux.1 img2img wording:Flux.2 actually encodes reference images as additional attention conditioning tokens — there's no noisy-latent init, and so no
strengthparameter. The existing wording is easy to misread when porting code fromStableDiffusionImg2ImgPipeline,FluxImg2ImgPipeline, orFluxKontextInpaintPipeline, all of which legitimately acceptstrength.We had a production serving stack pass
strength=alongsideimage=based on the existing wording and crashed with:Changes
image=docstring onFlux2Pipeline.__call__andFlux2KleinPipeline.__call__to make it explicit that this is reference conditioning, not img2img, and that there is nostrengthknob.## Reference conditioning vs. img2imgcallout todocs/source/en/api/pipelines/flux2.mddistinguishing the two modes, mentioningFlux2KleinInpaintPipelineas the right pipeline if you actually do need astrength-style noisy-latent init.Flux2KleinKVPipeline's docstring already correctly describes reference conditioning, so no change there.Flux2KleinInpaintPipelinedoes takestrengthand is left as-is.Out of scope (happy to add as a follow-up)
A small defensive check inside
__call__that intercepts unknown img2img kwargs and raises a clearTypeErrorpointing at this section of the docs, e.g.:Left out of this PR to keep it docs-only; happy to push as a second commit if maintainers prefer.
Behavioral change
None — docs only.
Fixes # (no related issue — surfaced in production)
Before submitting
Who can review?
Docs: @stevhliu @sayakpaul